<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试支付接口</title>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <script type="text/javascript" src="/static/js/jquery-1.9.1.min.js"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
    function onBridgeReady(){
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {:htmlspecialchars_decode($result)},
            function(res){
                if(res.err_msg == "get_brand_wcpay_request:ok" ){
                    alert('支付成功！');
                    window.location = "{$success_return_url}";
                }
                else{
                    $.get("{$fail_return_url}",function(data,status){
                        alert('支付失败！');
                        window.location = "{:fullPath('/index/index/index')}";
                    });
                }
            });
    }
    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }
</script>
</body>
</html>